<script>
function doubleclick(el, code) {
            if (el.getAttribute("data-dblclick") == null) {
                el.setAttribute("data-dblclick", 1);
                setTimeout(function () {
                    if (el.getAttribute("data-dblclick") == 1) {
                 //       onsingle();
                    }
                    el.removeAttribute("data-dblclick");
                }, 300);
            } else {
                el.removeAttribute("data-dblclick");
                location.href='{$smarty.const.base_admin}?act=edit-quangcao&id='+code;
            }
        }
	function setID(el,id)
	{
		var val=0;
		if(el.checked===true)
			val=1;
		$.get( "{$smarty.const.base_admin}?act=quang-cao&ajax=showhome&id="+id+"&value="+val, function( data ) {
		});
	}
</script>	<!-- BEGIN PAGE CONTAINER-->
         <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->   
            <div class="row-fluid">
               <div class="span12">
                   <!-- BEGIN THEME CUSTOMIZER-->
                   <div id="theme-change" class="hidden-phone">
                       <i class="icon-cogs"></i>
                        <span class="settings">
                            <span class="text">Theme Color:</span>
                            <span class="colors">
                                <span class="color-default" data-style="default"></span>
                                <span class="color-green" data-style="green"></span>
                                <span class="color-gray" data-style="gray"></span>
                                <span class="color-purple" data-style="purple"></span>
                                <span class="color-red" data-style="red"></span>
                            </span>
                        </span>
                   </div>
                   <!-- END THEME CUSTOMIZER-->
                  <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                   <h3 class="page-title">
                     {$nameact}
                   </h3>
                   <ul class="breadcrumb">
                       <li>
                           <a href="#">Home</a>
                           <span class="divider">/</span>
                       </li>
                       <li>
                           <a href="#">Data Table</a>
                           <span class="divider">/</span>
                       </li>
                       <li class="active">
                           Dynamic Table
                       </li>
                       <li class="pull-right search-wrap">
                           <form action="http://thevectorlab.net/metrolab/search_result.html" class="hidden-phone">
                               <div class="input-append search-input-area">
                                   <input class="" id="appendedInputButton" type="text">
                                   <button class="btn" type="button"><i class="icon-search"></i> </button>
                               </div>
                           </form>
                       </li>
                   </ul>
                   <!-- END PAGE TITLE & BREADCRUMB-->
               </div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN ADVANCED TABLE widget-->
            <div class="row-fluid">
                <div class="span6">
                <!-- BEGIN EXAMPLE TABLE widget-->
                <div class="widget red">
                    <div class="widget-title">
                        <h4><i class="icon-reorder"></i> {$nameact}</h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <a href="javascript:;" class="icon-remove"></a>
                            </span>
                    </div>
                    <div class="widget-body">
					<div class="clearfix">
                                     <div class="btn-group">
										{$msg}
                                     </div>
								 </div>
								 <div class="space15"></div>
                        <table class="table table-striped table-bordered" id="sample_1">
                            <thead>
                            <tr>
								<th width=5% style="text-align:center;"></th>
								<th width=40% style="text-align:center;">Tên</th>
								<th width=25% style="text-align:center;">Vị trí</th>
								<th width=15% style="text-align:center;">Thứ tự</th>
								<th width=30% style="text-align:center;">Hiển thị</th>
                            </tr>
                            </thead>
							
                            <tbody>
					{foreach from=$quangcao item=qc}
						<tr class="odd gradeX" onclick="doubleclick(this,'{$qc.id}');">
							<td width=5%>{$qc.count}</td>
							<td width=40%><a href="{$smarty.const.base_admin}?act=edit-quangcao&id={$qc.id}" style="color:#294871;font-weight:bold;">{$qc.name}</a></td>
							<td width=25%>{$qc.pn}</td>
							<td width=15%>{$qc.sort}</td>
							<td width=30%><input type=checkbox name=""{if $qc.is_active == 1} Checked{/if} onclick="setID(this,'{$qc.id}')"></td>
						</tr>
					{/foreach}
                            </tbody>
                        </table>
						<div class="pagination">
						<span class="pages">Page {$cur_page} of {$total}</span>
						{foreach from=$page item=pg}
							<a href="{$pg.link}" title="{$pg.title}">{$pg.title}</a>
						{/foreach}
					</div>
                    </div>
                </div>
                <!-- END EXAMPLE TABLE widget-->
                </div>
				<div class="span6">
					<div class="widget green">
                    <div class="widget-title">
                        <h4><i class="icon-reorder"></i> Thêm nhóm quảng cáo</h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <a href="javascript:;" class="icon-remove"></a>
                            </span>
                    </div>
					{$msg}
					<form method="POST" name="form1">
                    	<div class="widget-body form">
							<div class="control-group">
								<label class="control-label" style="float:left;width:200px">Tên quảng cáo</label>
								<div class="controls">
									<input class="span6 " type="text" name="name" value="" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" style="float:left;width:200px">Chiều cao</label>
								<div class="controls">
									<input class="span6 " type="text" name="height" value="" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" style="float:left;width:200px">Vị trí</label>
								<div class="controls">
									<select name="position">
									{foreach from=$pos item=p}
									<option value="{$p[0]}">{$p[1]}</option>
									{/foreach}
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" style="float:left;width:200px">Thứ tự</label>
								<div class="controls">
									<input class="span6 " type="text" name="sort" value="" />
								</div>
							</div>
							<div class="form-actions">
								<button type="submit" name="save" class="btn blue" value='Thêm nhóm quảng cáo'><i class=" icon-ok"></i> Thêm nhóm quảng cáo</button>
                            </div>
						</div>
					</form>
                </div>
				</div>
            </div>

            <!-- END ADVANCED TABLE widget-->
         </div>
         <!-- END PAGE CONTAINER-->